package com.china08.yxyapi.api.manage.tec.teaching.homework.workassign.question;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.china08.yxyapi.api.YxyApiBaseController;
import com.china08.yxyapi.model.YxyApiRespModel;
import com.china08.yxyapi.security.profile.YxyProfile;
import com.china08.yxyapi.service.manage.tec.teaching.homework.HomeworkQuestionService;

import io.swagger.annotations.ApiOperation;

/**
 * 移除收藏问题
 * 
 * @author renruihu
 *
 */
@RestController
@CrossOrigin
public class HomeworkQuestionCollectionRemoveController extends YxyApiBaseController {

    @Autowired
    private HomeworkQuestionService homeworkQuestionService;

    @ApiOperation(value = "作业系统移除收藏试题")
    @ResponseBody
    @RequestMapping(value = "/api_yw/manage/tec/teaching/homework/workassign/question/collection/remove/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public YxyApiRespModel precess(HttpServletRequest request, HttpServletResponse response,
            @PathVariable(value = "id") String id) {
        YxyProfile profile = getProfile(request, response);
        String userId = profile.getId();
        homeworkQuestionService.collectionRemoveQuestion(userId, id);
        // 获取
        return new YxyApiRespModel("操作成功");
    }

}
